package com.tim.shadow.lib;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.ScrollView;

import com.tim.shadow.lib.image.TImageCache;
import com.tim.shadow.lib.image.TImageView;

public class TimMainActivity extends Activity {
	String url0 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=989bea872e2eb938ec6d7df2e15a8435/b2de9c82d158ccbfa0fd5c5c18d8bc3eb1354117.jpg";
	String url1 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=b90e514600e9390156028a3e4fd455e7/ca1349540923dd5493994e0ed009b3de9d8248ea.jpg";
	String url2 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=26d17307f2deb48ffb69a6dec4273b29/960a304e251f95ca0ae37bd0c8177f3e67095246.jpg";
	String url3 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=e61b711dd01373f0f53f689f90374afb/8ad4b31c8701a18bb08efb299f2f07082838fe6b.jpg";
	String url4 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=1a5e2a55728da9774e2f812b8469f919/8b13632762d0f703c1417cba09fa513d2797c5e1.jpg";
	String url5 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=bda38f15faf2b211e42e824efeb86438/8435e5dde71190efdb5d7bb9cf1b9d16fdfa6036.jpg";
	String url6 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=0f5a7cc580cb39dbc1c06056e42e0824/b64543a98226cffccc89a79db8014a90f603ea7a.jpg";
	String url7 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=a43ce58db7fd5266a72b3b149f20962b/8326cffc1e178a829cf696c6f703738da877e88a.jpg";
	String url8 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=b525477f0d3387449cc5287c6537d9f9/ac345982b2b7d0a24ff51db2caef76094b369ae4.jpg";
	String url9 = "http://g.hiphotos.baidu.com/album/w%3D2048/sign=1f1c6aab5366d0167e199928a313d507/cefc1e178a82b9016c572a55728da9773812efda.jpg";
	String url10 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=457f427906082838680ddb148ca1a901/08f790529822720e6ef30b9c7acb0a46f21fab93.jpg";
	String url11 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=1a092a55728da9774e2f812b8469f919/8b13632762d0f703c1167cba09fa513d2697c534.jpg";
	String url12 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=f69496c6f703738dde4a0b228723b151/a8ec8a13632762d0b8964dd9a1ec08fa513dc628.jpg";
	String url13 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=ddb81f98c2fdfc03e578e4b8e0078694/83025aafa40f4bfbeea97732024f78f0f736185e.jpg";
	String url14 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=6721de5e7af40ad115e4c0e3631410df/f7246b600c33874486a2c61a500fd9f9d72aa075.jpg";
	String url15 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=4a8cff1834fae6cd0cb4ac613b8b0e24/728da9773912b31b6df6d3068718367adab4e103.jpg";
	String url16 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=4bdc49cff603918fd7d13aca65052797/242dd42a2834349b2bc070aac8ea15ce37d3bede.jpg";
	String url17 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=95d40d4572f082022d92963f7fc3faed/b21c8701a18b87d61fe04279060828381f30fd32.jpg";
	String url18 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=64828b99c8177f3e1034fb0d44f73ac7/aa18972bd40735fa538757969f510fb30f2408ad.jpg";
	String url19 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=02db9d62960a304e5222a7fae5f0a686/80cb39dbb6fd52662fd2d572aa18972bd50736df.jpg";
	String url20 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=fdb8db5e29381f309e198aa99d394d08/91529822720e0cf3b45da79d0b46f21fbe09aa2a.jpg";
	String url21 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=fa50e544b21bb0518f24b4280242dbb4/f603918fa0ec08fa021afac158ee3d6d55fbdaba.jpg";
	String url22 = "http://g.hiphotos.baidu.com/album/w%3D2048/sign=336a8a189358d109c4e3aeb2e560cdbf/b812c8fcc3cec3fd123d4e13d788d43f87942751.jpg";
	String url23 = "http://b.hiphotos.baidu.com/album/w%3D2048/sign=12e5b19dd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f26af89dd7c1ed21b0ef43b9e.jpg";
	String url24 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=b93386f9a50f4bfb8cd09954377779f0/86d6277f9e2f07081309c366e824b899a901f24c.jpg";
	String url25 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=76390565c995d143da76e32347c88302/dbb44aed2e738bd487825b57a08b87d6277ff931.jpg";
	String url26 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=fcccf97bd52a283443a6310b6f8dc8ea/adaf2edda3cc7cd91185ddbf3801213fb80e9128.jpg";
	String url27 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=3e45fc47cdbf6c81f7372be88806b035/9345d688d43f879406055001d31b0ef41bd53a22.jpg";
	String url28 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=ad1c120db21bb0518f24b4280242dbb4/f603918fa0ec08fa55560d8858ee3d6d55fbda4e.jpg";
	String url29 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=eb667cba09fa513d51aa6bde095554fb/359b033b5bb5c9ea6f27ea85d439b6003bf3b384.jpg";
	String url30 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=ccea08698694a4c20a23e02b3acc1ad5/aa64034f78f0f736b5a1a5670b55b319ebc4137c.jpg";
	String url31 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=46fc2759f31fbe091c5ec4145f580c33/64380cd7912397dd9c73802b5882b2b7d0a28792.jpg";
	String url32 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=0d90fc16b2de9c82a665fe8f58b9810a/c2cec3fdfc0392454940f9208694a4c27d1e2523.jpg";
	String url33 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=f029ad07377adab43dd01c43bfecb31c/503d269759ee3d6d5dcb99e442166d224f4ade8b.jpg";
	String url34 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=cf9c5bc2a5c27d1ea5263cc42fedac6e/024f78f0f736afc36292d603b219ebc4b745123d.jpg";
	String url35 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=534756d4b8014a90813e41bd9d4f3812/562c11dfa9ec8a132e77be86f603918fa0ecc063.jpg";
	String url36 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=1492d68763d9f2d3201123ef9dd48b13/0d338744ebf81a4c3e6905afd62a6059252da679.jpg";
	String url37 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=cb888071dcc451daf6f60beb82c55366/b219ebc4b74543a9527be2e31f178a82b90114b8.jpg";
	String url38 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=866a9f038601a18bf0eb154faa170608/42166d224f4a20a44b9d25e891529822720ed019.jpg";
	String url39 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=73a55cd03ac79f3d8fe1e3308e99cc11/7a899e510fb30f24f83ff52cc995d143ad4b0373.jpg";
	String url40 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=e259a79db8014a90813e41bd9d4f3812/562c11dfa9ec8a139f694fcff603918fa0ecc0aa.jpg";
	String url41 = "http://b.hiphotos.baidu.com/album/w%3D2048/sign=116ce67f2cf5e0feee188e01685835a8/c8177f3e6709c93d91bce7919e3df8dcd100540e.jpg";
	String url42 = "http://e.hiphotos.baidu.com/album/w%3D2048/sign=e259a79db8014a90813e41bd9d4f3812/562c11dfa9ec8a139f694fcff603918fa0ecc0aa.jpg";
	String url43 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=590595117aec54e741ec1d1e8d009b50/574e9258d109b3dee4b8fc47cdbf6c81800a4c9d.jpg";
	String url44 = "http://g.hiphotos.baidu.com/album/w%3D2048/sign=16506a3c08f79052ef1f403e38cbd6ca/c75c10385343fbf284e5bf0cb17eca8064388fd7.jpg";
	String url45 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=c4f1a6aeca1349547e1eef6462769258/d000baa1cd11728bdd3e920dc9fcc3cec3fd2c89.jpg";
	String url46 = "http://f.hiphotos.baidu.com/album/w%3D2048/sign=b9aa514600e9390156028a3e4fd455e7/ca1349540923dd54933d4e0ed009b3de9c82480e.jpg";
	String url47 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=eba07cba09fa513d51aa6bde095554fb/359b033b5bb5c9ea6fe1ea85d439b6003af3b342.jpg";
	String url48 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=fed5467cf7246b607b0eb574dfc01b4c/96dda144ad345982f26bfdbd0df431adcbef843f.jpg";
	String url49 = "http://d.hiphotos.baidu.com/album/w%3D2048/sign=74ee3dc0a8ec8a13141a50e0c33b908f/500fd9f9d72a605906eff8352934349b033bba25.jpg";
	String url50 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=991fae1d5bafa40f3cc6c9dd9f5c024f/a08b87d6277f9e2fede704271e30e924b999f3cb.jpg";
	String url60 = "http://a.hiphotos.baidu.com/album/w%3D2048/sign=4a98da1c728da9774e2f812b8469f819/8b13632762d0f70391878cf309fa513d2697c5e3.jpg";
	String url61 = "http://h.hiphotos.baidu.com/album/w%3D2048/sign=fa612af63801213fcf3349dc60df37d1/48540923dd54564ee529fa16b2de9c82d1584f54.jpg";
	String url62 = "http://c.hiphotos.baidu.com/album/w%3D2048/sign=6e7ff28ba2cc7cd9fa2d33d90d39203f/35a85edf8db1cb138b84d575dc54564e93584be3.jpg";
	String url63 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url64 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url65 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url66 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url67 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url68 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url69 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url70 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url71 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url72 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url73 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url74 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url75 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url76 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url77 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url78 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url79 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url80 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url81 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url82 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url83 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url84 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url85 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url86 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url87 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url88 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	String url89 = "http://202.75.218.230:82/uploads/如此幸运遇上你.jpg";
	ListView list;

	String[] liststr = new String[] { url0, url1, url2, url3, url4, url5, url6,
			url7, url8, url9, url10, url11, url12, url13, url14, url15, url16,
			url17, url18, url19, url20, url21, url22, url23, url24, url25,
			url26, url27, url28, url29, url30, url31, url32, url33, url34,
			url35, url36, url37, url38, url39, url40, url41, url42, url43,
			url44, url45, url46, url47, url48, url49, url50, url60, url61,
			url62, url63, url64, url65, url66, url67, url68, url69, url70,
			url71, url72, url73, url74, url75, url76, url77, url78, url79,
			url80, url81, url82, url83, url84, url85, url86, url87, url88,
			url89 };

	Adapter mAdapter = new Adapter();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tim_main);

		list = (ListView) findViewById(R.id.listview);
		list.setAdapter(mAdapter);
		list.setOnScrollListener(new OnScrollListener() {

			@Override
			public void onScrollStateChanged(AbsListView view, int scrollState) {
				if (SCROLL_STATE_IDLE == scrollState) {
					TImageView.cancelLoading();
				}
			}

			@Override
			public void onScroll(AbsListView view, int firstVisibleItem,
					int visibleItemCount, int totalItemCount) {

			}
		});
		// new Thread(new Runnable() {
		//
		// @Override
		// public void run() {
		// while (i < 100) {
		// i++;
		// list.invalidate();
		// }
		// }
		// }).start();
	}

	class Adapter extends BaseAdapter {

		@Override
		public int getCount() {
			return liststr.length;
		}

		@Override
		public Object getItem(int position) {
			return liststr[position];
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			TImageView iv = (TImageView) LayoutInflater.from(
					TimMainActivity.this).inflate(R.layout.item, null);
			iv.loadImageNet(liststr[position]);
			convertView = iv;
			return convertView;
		}
	}

}
